import React, { Component } from 'react'
import HomeNews from './Home_News'
import HomeMessage from './Home_Message'
import { Link, Route, NavLink, Switch, Redirect } from "react-router-dom";
export default class Home extends Component {
  render() {
    console.log(this);
    return (
      <div>
        <h1>Home组件</h1>
        {/* 编写导航链接 */}
        <NavLink to="/home/news">跳转到news</NavLink>
        &nbsp;
        &nbsp;
        <NavLink to="/home/message">跳转到message</NavLink>
        {/* 注册路由 */}
        <Switch>
          <Route path="/home/news" component={HomeNews} /> 
          <Route path="/home/message" component={HomeMessage} />
          <Redirect to="/home/news"></Redirect>
        </Switch>
      </div>
    )
  }
}
